package com.cecsmsserve.controller;

import com.cecsmsserve.service.IActivityService;
import com.cecsmsserve.service.IServiceOrderService;
import com.cecsmsserve.service.IUserService;
import com.cecsmsserve.util.result.CommonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@CrossOrigin
@RestController
@RequestMapping("/count")
public class CountController {

    @Autowired
    IServiceOrderService serviceOrderService;

    @Autowired
    IUserService userService;

    @Autowired
    IActivityService activityService;

    //统计角色数量，以下忽略
    @GetMapping("/getSum/{rId}")
    public CommonResult getSum(@PathVariable int rId){
        return userService.getSum(rId);
    }

    //统计客户数量
    @GetMapping("/getUsersSum")
    public CommonResult getUsersSum(){
        return userService.getUsersSum();
    }

    //统计医护人员数量
    @GetMapping("/getDoctorSum")
    public CommonResult getDoctorSum(){
        return userService.getDoctorSum();
    }

    //统计工作者数量
    @GetMapping("/getWorkerSum")
    public CommonResult getWorkerSum(){
        return userService.getWorkerSum();
    }

    //统计服务订单评分
    @GetMapping("/countRate")
    public CommonResult countRate(){
        return serviceOrderService.countRate();
    }

    //统计各类型活动的报名人次比例
    @GetMapping("/countSignedUpNum")
    public CommonResult countSignedUpNum(){
        return activityService.countSignedUpNum();
    }

    //活动排名
    @GetMapping("/countActivitySort")
    public CommonResult countActivitySort(){
        return activityService.countActivitySort();
    }
}
